package Spring.demo.component;

import Spring.demo.model.User;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

@Controller
public class UserBean {

    @Scope("prototype")
    @Bean
    public User user1()
    {
        User user=new User();
        user.setId(1);
        user.setName("张三");
        user.setPassword("123");
        return  user;
    }
    //@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
//    @Bean
//    public User user2()
//    {
//        User user=new User();
//        user.setId(1);
//        user.setName("张三");
//        user.setPassword("123");
//        return  user;
//    }
}
